﻿using System;
using System.Diagnostics;

namespace Bing
{
    /// <summary>
    /// Contains response fields related to an error.
    /// </summary>
    [DebuggerDisplay("Code:{Code}, Message: {Message}, Parameter: {Parameter}, Value:{Value}")]
    public class Error
    {
        /// <summary>
        /// Gets or sets the error code that corresponds to an error message.
        /// </summary>
        /// <value>Error code that corresponds to an error message.</value>
        public UInt32 Code { get; set; }

        /// <summary>
        /// Gets or sets the message text sent for a given error.
        /// </summary>
        /// <value>Message text sent for a given error.</value>
        public string Message { get; set; }
        
        /// <summary>
        /// Gets or sets the URL to which to refer for more information about error messages or codes.
        /// </summary>
        /// <value>URL to which to refer for more information about error messages or codes.</value>
        public string HelpUrl { get; set; }

        // TODO: Documentation Error: http://msdn.microsoft.com/en-us/library/dd250952.aspx, Incorrect accessibility. It should be public
        /// <summary>
        /// Gets or sets the parameter the was involved in this error.
        /// </summary>
        /// <value>When an error involves a parameter, this property returns the parameter.</value>
        public string Parameter { get; set; }

        /// <summary>
        /// Gets or sets the SourceType that caused the error.
        /// </summary>
        /// <value>When an error is specific to a SourceType, this property returns the name of the SourceType. </value>
        public string SourceType { get; set; }

        /// <summary>
        /// Gets or sets the SourceType specific error code.
        /// </summary>
        /// <value>When an error is specific to a SourceType, this property returns the error code related to the SourceType. </value>
        public UInt32 SourceTypeErrorCode { get; set; }

        /// <summary>
        /// Gets or sets the value of the parameter
        /// </summary>
        /// <value>When an error involves a parameter, this property returns the invalid value provided by the user in the request.</value>
        public string Value { get; set; }
        
    }
}
